<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>ins1st cloud v1.0 | 很赞的SpringCloud分布式系统</title>
    <link rel="stylesheet" href="${ctxPath}/static/lib/layui/css/layui.css">
    <link rel="stylesheet" href="${ctxPath}/static/css/login.css">
    <script>
        if (window != top) {
            top.location.replace(location.href);
        }
    </script>
</head>
<body>
<div class="login-wrapper">
    <div class="login-body">
        <div class="layui-card">
            <div class="layui-card-header">
                <i class="layui-icon layui-icon-engine"></i>&nbsp;&nbsp;Ins1st Cloud 用户登录
            </div>
            <form class="layui-card-body layui-form layui-form-pane">
                <div class="layui-form-item">
                    <label class="layui-form-label">租户</label>
                    <div class="layui-input-block">
                        <select class="layui-input" lay-verify="required" name="tenantId">
                            <option value="">请选择</option>
                            @if(isNotEmpty(sysTenantsList)){
                            @for(r in sysTenantsList){
                            <option value="${r.tenantId}">${r.tenantName}</option>
                            @}
                            @}
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">账号</label>
                    <div class="layui-input-block">
                        <input name="userName" type="text" placeholder="账号" class="layui-input"
                               lay-verType="tips" lay-verify="required" required/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-block">
                        <input name="userPassword" type="password" placeholder="密码" class="layui-input"
                               lay-verType="tips" lay-verify="required" required/>
                    </div>
                </div>
                <div class="layui-form-item" pane="">
                    <label class="layui-form-label" lay-tips="7天内免登陆">记住我</label>
                    <div class="layui-input-block">
                        <input type="radio" name="remember" value="on" title="是"><div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i><div>是</div></div>
                        <input type="radio" name="remember" value="off" title="否" checked=""><div class="layui-unselect layui-form-radio layui-form-radioed"><i class="layui-anim layui-icon"></i><div>否</div></div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <button lay-filter="login" class="layui-btn layui-btn-fluid" lay-submit>登 录</button>
                </div>
            </form>
        </div>
    </div>

    <div class="login-footer">
        <p>© 2019 ins1st 版权所有</p>
    </div>
</div>

<!-- js部分 -->
<script src="${ctxPath}/static/lib/layui/layui.js"></script>
<script src="${ctxPath}/static/lib/ztree/js/jquery-1.4.4.min.js"></script>
<script src="${ctxPath}/static/js/ins1st.js"></script>
<script>
    layui.use(['form', 'ax', 'okGVerify'], function () {

        let $ax = layui.ax;
        let form = layui.form;

        /**
         * 表单提交
         */
        form.on("submit(login)", function (data) {
            admin.show();
            let ax = new $ax("${ctxPath}/doLogin", function (result) {
                if (result.success) {
                    admin.hide();
                    admin.success(result.message, function () {
                        window.location = "${ctxPath}/";
                    }, function () {
                        window.location = "${ctxPath}/";
                    });
                } else {
                    admin.error(result.message);
                }
            });
            ax.set(data.field);
            ax.start();
            return false;
        });
    });
</script>
</body>
</html>